<?php
namespace app\admin\model\operating;
use think\Model;
use think\facade\Db;
use app\admin\common;
class SettingAgreement extends Model {
	private $table_obj;
	/**
	 * 
	 */
	public function getSettingAgreement($where,$field='*'){
		extract(common::get('setting_agreement',[$where,$field]));
		
		if(empty($data)){
			$data=Db::name("setting_agreement")->where($where)->field($field)->select();
			
			common::set($data->toArray());
			return $data->toArray();
		}
		
		return $data;
	}
	
	/**
	 * @Purpose 查找协议
	 * 
	 */
	public function findSettingAgreement($where,$field){
		$data=Db::name("setting_agreement")->where($where)->field($field)->find();
		return $data;
	}
	/**
	 *
	 * 存储数据 
	 */
	
	public function settingAgreementInsert($data_insert){
		common::delete("setting_agreement");
		return Db::name('setting_agreement')->strict(false)->insert($data_insert);
		
	}
	/**
	 * 更新
	 * 
	 */
	public function settingAgreementUpdate($up,$where){
		common::delete("setting_agreement");
		return Db::name('setting_agreement')
		    ->where($where)
		    ->update($up);
	}
}
?>